package com.casic.ops.entity.vo;

import com.casic.ops.entity.domain.ApplicationActionDO;
import com.orion.utils.convert.TypeStore;
import lombok.Data;

/**
 * @ClassName ops-platform
 * @Description  应用构建统计分析操作
 * @Author mianbin
 * @Date 2022/5/31 10:59
 * @Version 1.0
 **/
@Data
public class ApplicationStatisticsActionVO {

    /**
     * id
     */
    private Long id;

    /**
     * 操作名称
     */
    private String name;

    /**
     * 平均操作时长ms (成功)
     */
    private Long avgUsed;

    /**
     * 平均操作时长 (成功)
     */
    private String avgUsedInterval;

    public static ApplicationStatisticsActionVO actionDO2statisticsActionVO(ApplicationActionDO p) {
        ApplicationStatisticsActionVO vo = new ApplicationStatisticsActionVO();
        vo.setId(p.getId());
        vo.setName(p.getActionName());
        return vo;
    }

    static {
        TypeStore.STORE.register(ApplicationActionDO.class, ApplicationStatisticsActionVO.class, p -> {
            ApplicationStatisticsActionVO vo = new ApplicationStatisticsActionVO();
            vo.setId(p.getId());
            vo.setName(p.getActionName());
            return vo;
        });
    }
}
